﻿#region ... Copyright Notice ...
/*
   Copyright 2008 Tyler Jensen

	Author: Tyler Jensen    http://www.tsjensen.com/blog

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace Atrax.Library
{
	[DataContract, Serializable]
	public class QueryHeader
	{
		/// <summary>
		/// The client license key. Used to identify client in logging and processing.
		/// </summary>
		[DataMember]
		public string LicenseKey { get; set; }
		
		/// <summary>
		/// The internal query ID created when the original request is made<br/>
		/// and returned in the immediate response from the query dispatcher.
		/// </summary>
		[DataMember]
		public string QueryId { get; set; }
		
		/// <summary>
		/// This value is a client application reference to the query which<br/>
		/// can be used as a reference key when the asynchronous result is returned.
		/// </summary>
		[DataMember]
		public string ClientQueryId { get; set; }

		/// <summary>
		/// Used to determine validity of the Query on the master and spider nodes.<br />
		/// This value is assigned by the dispatcher once the request has been authenticated<br/>
		/// and it decrypted by the master and spider nodes to determine the authenticity of the request.
		/// </summary>
		[DataMember]
		public string AuthenticationToken { get; set; }

		/// <summary>
		/// The query type name used to determine which query processor will handle the query.
		/// </summary>
		[DataMember]
		public string QueryType { get; set; }

		/// <summary>
		/// The Url to which the results will be posted. The result form fields in the HTTP POST are:<br/>
		/// queryid: the user reference key passed originally in this query<br/>
		/// querytype: the query type passed originally in this query<br/>
		/// statuscode: the status code of the query<br/>
		/// statusdescription: the description of the status which may include error details<br/>
		/// resultschema: the XML schema of the result<br/>
		/// result: the XML data result of the query
		/// </summary>
		[DataMember]
		public string CallbackUrl { get; set; }

		/// <summary>
		/// The email to which exception notifications will be sent.
		/// </summary>
		[DataMember]
		public string NotificationEmail { get; set; }

		/// <summary>
		/// The query priority. Higher number gets higher priority. Use values between 0 and 100.
		/// </summary>
		[DataMember]
		public int Priority { get; set; }

		/// <summary>
		/// The number of times the query has been attempted by the master.
		/// </summary>
		[DataMember]
		public int ProcessingAttempts { get; set; }
	}
}
